package com.bush.mall.product.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.product.entity.SkuInfoEntity;
import com.bush.mall.product.service.SkuInfoService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * sku信息
 * @author RUN
 * @date 2022-11-28
 */
@RestController
@RequestMapping("skuinfo")
@Api(tags = "sku信息管理" )
public class SkuInfoController {

    @Resource(name= SkuInfoService.BEAN_ID)
    private SkuInfoService skuInfoService;

    /**
     * 分页查询sku信息列表
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "分页查询sku信息列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return skuInfoService.queryForPage(current,size);
    }

    /**
     * 保存sku信息表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "保存sku信息表单")
    @PostMapping("saveSkuInfo")
    public Result saveSkuInfo(@RequestBody SkuInfoEntity skuInfo){
        return skuInfoService.saveSkuInfo(skuInfo);
    }

    /**
     * 修改sku信息表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "修改sku信息表单")
    @PutMapping("updateSkuInfo")
    public Result updateSkuInfo(@RequestBody SkuInfoEntity skuInfo){
        return skuInfoService.updateSkuInfo(skuInfo);
    }

    /**
     * 通过指定id删除sku信息
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "通过指定id删除sku信息")
    @DeleteMapping("deleteSkuInfo")
    public Result deleteSkuInfo(Long id){
        return skuInfoService.deleteSkuInfo(id);
    }

}
